﻿using UnityEngine;
using System.Collections;

public class LastFace : MonoBehaviour 
{
    public static LastFace instance;
    public GameObject Game;
    public GameObject lastFacePrefab;
    public GameObject theFace;

    void Awake()
    {
        instance = this;        
    }

	void Start () 
    {
        
	}	

	void Update () 
    {
	
	}

    public void InstantiateLastface()
    {
        lastFacePrefab = ObjectPool.instance.objectPrefabs[PlayerPrefs.GetInt("lastFaceIndex")];
        theFace = ObjectPool.instance.Instantiate(lastFacePrefab, transform.position, new Quaternion(0, 0, 0, 0)) as GameObject;
    }

    public void DestroyFace()
    {      
        ObjectPool.instance.Destroy(theFace);
    }

    public void SetLastFace(int index)
    {
        PlayerPrefs.SetInt("lastFaceIndex", index);
    }
}
